﻿using LD.Host;
using ReaLTaiizor.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using System.Windows.Forms;

namespace LD.BC
{
    public partial class IoControl : UserControl
    {
        public IoControl()
        {
            InitializeComponent();
        }
        private int no;
        public int No
        {
            get { return no; }
            set
            {
                no = value;
                this.lab_ioNo.Text = no.ToString();
            }
        }
        private int signal;

        public int Signal
        {
            get { return signal; }
            set
            {
                signal = value;
                this.pic_signal.Image = imageList2.Images[signal];
            }
        }
        private string ioName;

        public string IoName
        {
            get { return ioName; }
            set
            {
                ioName = value;
                this.lab_ioName.Text = ioName;
            }
        }

        public IoType IoType { get; set; }

        private void btn_light_Click(object sender, EventArgs e)
        {
            if (IoType == IoType.输入) return;
            var sinnal = BcFactory.Instance.Control.GetOut((ushort)no);
            if (sinnal == 0)
                BcFactory.Instance.Control.SetOut((ushort)no, 1);
            else
                BcFactory.Instance.Control.SetOut((ushort)no, 0);

        }
    }
}
